const gulp = require('gulp');
const less = require('gulp-less');
const LessAutoprefix = require('less-plugin-autoprefix');
const browsers = [
    '> 0.5%',
    'last 2 versions',
    'Firefox ESR',
    'not dead',
    'IE 9-11'
];
const autoprefix = new LessAutoprefix({ browsers });

gulp.task('less', () => {
    return gulp.src('./src/**/*.less')
        .pipe(less({
            plugins: [autoprefix]
        }))
        .pipe(gulp.dest('./src'));
});

gulp.task('watch:less', () => {
    gulp.watch('./src/**/*.less', gulp.series('less'));
});